/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package fr.cggveritas.crewintranet.jms.entities;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import org.codehaus.jackson.annotate.JsonIgnore;

/**
 *
 * @author Alassane
 */
@Entity
@Table(name = "cv_typedecontrat")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "CvTypedecontrat.findAll", query = "SELECT c FROM CvTypedecontrat c"),
    @NamedQuery(name = "CvTypedecontrat.findByActive", query = "SELECT c FROM CvTypedecontrat c WHERE c.active = :active"),
    @NamedQuery(name = "CvTypedecontrat.findByTypecontrat", query = "SELECT c FROM CvTypedecontrat c WHERE c.typecontrat = :typecontrat")})
public class CvTypedecontrat implements Serializable {
    @Column(name = "active")
    private boolean active;
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "typecontrat")
    private String typecontrat;
    @Lob
    @Column(name = "infossuplementaire")
    private String infossuplementaire;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "typecontrat", fetch = FetchType.LAZY)
    private List<CvTravail> cvTravailList;

    public CvTypedecontrat() {
    }

    public CvTypedecontrat(String typecontrat) {
        this.typecontrat = typecontrat;
    }

    public String getTypecontrat() {
        return typecontrat;
    }

    public void setTypecontrat(String typecontrat) {
        this.typecontrat = typecontrat;
    }

    public String getInfossuplementaire() {
        return infossuplementaire;
    }

    public void setInfossuplementaire(String infossuplementaire) {
        this.infossuplementaire = infossuplementaire;
    }

    @XmlTransient
    @JsonIgnore
    public List<CvTravail> getCvTravailList() {
        return cvTravailList;
    }

    public void setCvTravailList(List<CvTravail> cvTravailList) {
        this.cvTravailList = cvTravailList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (typecontrat != null ? typecontrat.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CvTypedecontrat)) {
            return false;
        }
        CvTypedecontrat other = (CvTypedecontrat) object;
        if ((this.typecontrat == null && other.typecontrat != null) || (this.typecontrat != null && !this.typecontrat.equals(other.typecontrat))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "fr.cggveritas.crewintranet.jms.entities.CvTypedecontrat[ typecontrat=" + typecontrat + " ]";
    }

    public boolean isActive() {
        return active;
    }

    public void setActive(Boolean active) {
        this.active = active;
    }
    
}
